from uiautomator import device as d
import time


def test_login():
    try:
        # 按下我的
        d(resourceId="com.bobbygu.bobbyapp:id/av_mine").click()
        time.sleep(1)
        # 按下登录
        d(text="登录").click()
        time.sleep(1)
        # 输入用户名
        d(resourceId="com.bobbygu.bobbyapp:id/tv_user").set_text("bobby")
        time.sleep(1)
        # 清空密码EditText
        d(resourceId="com.bobbygu.bobbyapp:id/tv_pass").set_text("123123")
        time.sleep(1)
        d(text="Sign in").click()
        print("--------------test_login OK")

    except Exception as e:
        print("Error: 登录未成功\n", e)
